(
    ()=>{
        Promise.race([
            new Promise((resolve, reject) =>{
                setTimeout(()=>reject("index0"),1000)
            } ),
            new Promise((resolve, reject) => {
                setTimeout(()=>resolve("index1"),2000)
            }),
            new Promise((resolve, reject) => {
                setTimeout(()=>resolve("index2"),500)
            })
        ]).then((e)=>{
            console.log("success "+e);
        }).catch((err)=>{
            console.log("error "+err);
        })
    }
)()